﻿/*****************************************************************************
 * 作者：董辉
 * 类型：新建
 * 时间：2011-4-8 16:35
 * 说明：页面加载时在右区域显示的页面
 * **************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.Supervise.Model;

namespace HZ.Supervise.Web.PageControl
{
	public partial class Right_Index : BasePage
	{

		HZ.Supervise.IBLL.IBLL_User ibllEntity = BLLFactory.BLL_User();

		protected void Page_Load(object sender, EventArgs e)
		{

		}

		/// <summary>
		/// 曹鹏
		/// 2011年4月26日9:02:35
		/// 通过菜单名称和用户编号查看是否有权限
		/// </summary>
		/// <param name="menuName"></param>
		/// <returns></returns>
		public string CheckMenuByUserID(string moduleName)
		{
			if (CurrentAccount.GetUser().UserID == "root")//如果是超级管理员，权限全开
			{

				return "";

			}
			else
			{

				string strCheck = "Check,No";

				IList<HZ.Supervise.Model.OperatingRule> list = ibllEntity.GetUserOperatingRule(CurrentAccount.GetUser().UserID);//得到该用户拥有的所有权限

				if (moduleName == "趋势走向")
				{

					foreach (HZ.Supervise.Model.OperatingRule itemMenu in list)//遍历
					{

						if (itemMenu.Module.ToString() == moduleName)//匹配
						{

							strCheck = "WayGoCheckPass," + itemMenu.OperatingRuleName;

							break;

						}

					}
					return strCheck;

				}

				else if (moduleName == "系统管理")
				{

					foreach (HZ.Supervise.Model.OperatingRule itemMenu in list)//遍历
					{

						if (itemMenu.Module.ToString() == "用户信息管理")//匹配
						{

							if (itemMenu.OperatingRuleName != "主用户管理")
							{

								strCheck = "SystemManageCheckPass," + itemMenu.OperatingRuleName;

								break;

							}

						}
					}
					return strCheck;


				}
				else if (moduleName == "企业统计")
				{
					foreach (HZ.Supervise.Model.OperatingRule itemMenu in list)//遍历
					{

						if (itemMenu.Module.ToString() == moduleName)//匹配
						{

							strCheck = "CompanyAllCheckPass," + itemMenu.OperatingRuleName;

							break;

						}

					}

					return strCheck;

				}

				else if (moduleName == "预警提示")
				{
					foreach (HZ.Supervise.Model.OperatingRule itemMenu in list)//遍历
					{

						if ((itemMenu.Module.ToString() == "预警设置") || (itemMenu.Module.ToString() == "预警控制") || (itemMenu.Module.ToString()) == "预警处理")//匹配
						{

							strCheck = "BeforShowCheckPass," + itemMenu.OperatingRuleName;

							break;

						}

					}

					return strCheck;

				}

				else if (moduleName == "地区统计")
				{
					foreach (HZ.Supervise.Model.OperatingRule itemMenu in list)//遍历
					{

						if ((itemMenu.Module.ToString() == moduleName))//匹配
						{

							strCheck = "AreaAllCheckPass," + itemMenu.OperatingRuleName;

							break;

						}


					}

					return strCheck;

				}

				else if (moduleName == "对比统计")
				{
					foreach (HZ.Supervise.Model.OperatingRule itemMenu in list)//遍历
					{

						if ((itemMenu.Module.ToString() == moduleName))//匹配
						{

							strCheck = "MirooAllCheckPass," + itemMenu.OperatingRuleName;

							break;

						}
					}

					return strCheck;

				}

				//2011-0506
				else if (moduleName == "医院统计")
				{
					foreach (HZ.Supervise.Model.OperatingRule itemMenu in list)//遍历
					{

						if ((itemMenu.Module.ToString() == moduleName))//匹配
						{

							strCheck = "HospitalAllCheckPass," + itemMenu.OperatingRuleName;

							break;

						}
					}

					return strCheck;

				}

				else if (moduleName == "自定义查询")
				{
					foreach (HZ.Supervise.Model.OperatingRule itemMenu in list)//遍历
					{
						if ((itemMenu.Module.ToString() == "医院统计分析") || (itemMenu.Module.ToString() == "企业统计分析") || (itemMenu.Module.ToString() == "药品统计分析") || (itemMenu.Module.ToString() == "履约管理") || (itemMenu.Module.ToString() == "地区统计分析") || (itemMenu.Module.ToString() == "药品配送汇总管理") || (itemMenu.Module.ToString() == "意见反馈"))//由于“自定义查询”下有7个模块，所以得一个个判断
						{

							strCheck = "SelfAllCheckPass," + itemMenu.OperatingRuleName;

							break;

						}
					}

					return strCheck;

				}
				else if (moduleName == "意见反馈")
				{
					foreach (HZ.Supervise.Model.OperatingRule itemMenu in list)//遍历
					{

						if (itemMenu.Module.ToString() == moduleName)//匹配
						{

							strCheck = "IdeaCheckPass," + itemMenu.OperatingRuleName;

							break;

						}
					}

					return strCheck;

				}

				else if (moduleName == "报表统计")
				{
					foreach (HZ.Supervise.Model.OperatingRule itemMenu in list)//遍历
					{

						if (itemMenu.Module.ToString() == moduleName)//匹配
						{

							strCheck = "ReportAllCheckPass," + itemMenu.OperatingRuleName;

							break;

						}
					}

					return strCheck;

				}
				return strCheck;

			}

		}

		protected string GetSessionID()
		{

			string sessionid = Guid.NewGuid().ToString();

			SuperviseQuery query = new SuperviseQuery();

			query.CompanyType = 2;

			Session[sessionid] = query;

			return sessionid;
		}
	}
}
